package com.zhengxiang.onlinexamination.controller;

import com.zhengxiang.onlinexamination.base.AjaxResult;
import com.zhengxiang.onlinexamination.base.BaseController;
import com.zhengxiang.onlinexamination.entity.vo.QuVo;
import com.zhengxiang.onlinexamination.service.QuService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (ZQu)表控制层
 *
 * @author 
 * @since 2023-03-08 14:06:09
 */
@RestController
@RequestMapping("qu")
public class QuController extends BaseController {
    /**
     * 服务对象
     */
    @Resource
    private QuService quService;

    /**
     * 试题列表
     * @param quVo
     * @return
     */
    @PostMapping("/queryAll")
    public AjaxResult queryAll(@RequestBody QuVo quVo){
        return AjaxResult.success(quService.queryAll(quVo));
    }

    /**
     * 添加试题
     * @param quVo
     * @return
     */
    @PostMapping("/saveQu")
    public AjaxResult saveQu(@RequestBody QuVo quVo){
        quService.saveQu(quVo);
        return AjaxResult.success();
    }
    /**
     * 更新试题
     * */
    @PostMapping("/updateQu")
    public AjaxResult updateQu(@RequestBody QuVo quVo){
        quService.updateQu(quVo);
        return AjaxResult.success();
    }
    /**
     * 题目详情
      * @return
     */
    @GetMapping("/queryQuInfo")
    public AjaxResult queryQuInfo(Integer quId){

        return AjaxResult.success(quService.queryInfo(quId));
    }
}

